package cn.com.pc.content.vo;

import cn.com.pc.content.domain.article.Article;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

/**
 * 文章视图
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class ArticleViewVO extends Article {

    private String viewType;
    private String view;

    public static ArticleViewVO from(Article article, String viewType, String view) {
        ArticleViewVO articleViewVo = new ArticleViewVO();
        BeanUtils.copyProperties(article, articleViewVo);
        articleViewVo.setViewType(viewType);
        articleViewVo.setView(view);
        return articleViewVo;
    }
}
